import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn, ManyToOne } from 'typeorm';
import { UserEntity } from '../../user/entities/user.entity';
import { EnterpriseEntity } from '../../enterprise/entities/enterprise.entity';
import { BaseEntity } from 'src/common/entitys/base';

@Entity({ name: 'sys_driver', comment: '司机表' })
export class DriverEntity extends BaseEntity {
  @PrimaryGeneratedColumn({ name: 'driver_id', comment: '司机ID' })
  driverId: number;

  @OneToOne(() => UserEntity, { nullable: true })
  @JoinColumn({ name: 'user_id' })
  user: UserEntity;

  @Column({ name: 'driver_license', type: 'varchar', length: 255, nullable: true, comment: '驾照' })
  driverLicense: string;

  @Column({ name: 'vehicle_registration', type: 'varchar', length: 255, nullable: true, comment: '行驶证' })
  vehicleRegistration: string;

  @Column({ name: 'license_plate', type: 'varchar', length: 255, nullable: true, comment: '车牌号' })
  licensePlate: string;
}
